//
//  IBizCache.h
//  BizClientKit
//
//  Created by Cool Camel on 16/9/7.
//  Copyright © 2016年 www.biz-united.com.cn. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BizMObject.h"

//临时目录
#define kSDKTemparyDirectory    \
NSTemporaryDirectory()

//Document目录
#define kSDKDocumentDirectory   \
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

//Cache目录
#define kSDKCacheDirectory      \
[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]\ stringByAppendingPathComponent:@"GDChatCache"]

//Library目录
#define kSDKLibraryDirectory    \
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]

//用户数据库目录
#define kSDKUserDBDirectory(name)   \
[kSDKLibraryDirectory stringByAppendingPathComponent:name]



typedef NS_ENUM(NSUInteger, Biz_CACHE_TYPE) {
    
    //NSDefault缓存
    Biz_CACHE_TYPE_DEFAULT   = 0,
    //NSArchive缓存
    Biz_CACHE_TYPE_ARCHIVE   = 1,
    //PList缓存
    Biz_CACHE_TYPE_PLIST     = 2,
    //SQLite缓存
    Biz_CACHE_TYPE_SQLITE    = 3
};


@protocol IBizCache <NSObject>
@required
@property (nonatomic, strong, readonly, nonnull) NSString * name;

+ (BOOL)cacheIsExistWithName:(nonnull NSString *)name;

- (BOOL)updateWithKey:(nonnull NSString *)key Object:(nonnull id)object;
- (BOOL)deleteWithKey:(nonnull NSString *)key;
- (nullable id)loadObjectWithKey:(nonnull NSString *)key;
- (nonnull NSDictionary<NSString *, NSDictionary *> *)allObjects;
@end
